package com.example.controller.other;

import com.example.domain.Admin;

import javax.servlet.http.HttpSession;

/** 控制器类的基类 */
public class BaseController {
    //获取管理员的id
    public Long getSessionId(HttpSession session){
        Admin admin=(Admin)session.getAttribute("admin");
        return admin.getId();
    }
    //获取session中管理员的username
    public String getSessionUsername(HttpSession session){
        Admin admin=(Admin)session.getAttribute("admin");
        return admin.getUsername();
    }
    //获取session中管理员的admin
    public Admin getSessionUser(HttpSession session){
        Admin admin=(Admin)session.getAttribute("employee");
        return admin;
    }
}
